package com.aurora.supermarket.base;

import com.lzy.okgo.callback.AbsCallback;
import com.lzy.okgo.request.base.Request;

import okhttp3.Response;

/**
 * Created by Administrator on 2017/5/24.
 */
public abstract class JsonCallback extends AbsCallback<String > {

    @Override
    public String convertResponse(Response response) throws Throwable {
        return response.body().string();
    }

    @Override
    public void onStart(Request<String, ? extends Request> request) {
        super.onStart(request);
    }

/*    @Override
    public void onBefore(BaseRequest request) {
        super.onBefore(request);
        // 主要用于在所有请求之前添加公共的请求头或请求参数
        // 例如登录授权的 token
        // 使用的设备信息
        // 可以随意添加,也可以什么都不传
        // 还可以在这里对所有的参数进行加密，均在这里实现
       // request.params("cityId", AppPreference.getAppPreference().getString(AppPreference.CITY_ID,""));
       *//* request.params("appSecret", "oHVHR8AZD2adPQ")
        .params("appKey", "6UyYIhZR906DREYjTsoreWQWuJHubBGI");*//*
    }*/

/*    @Override
    public String convertSuccess(Response response) throws Exception {
        return response.body().string();
    }

    @Override
    public void onError(Call call, Response response, Exception e) {
        super.onError(call, response, e);
        e.printStackTrace();
    }*/
}
